
<div class="titlebar">
    <i class="iconfont icon-line-chart_icon"></i><span class="fn-fb blue">{$store_name}</span> 数据统计
    <div class="fn-right">
        <form class="input-group" id="form" action="{:url('coupon/index',['types' => 0])}">
            <input placeholder="开始时间" class="input w100 ui-date" type="text" name="starttime" readonly autocomplete="false" value="{$starttime}"/>
            <input placeholder="结束时间" class="input w100 ui-date" type="text" name="endtime" readonly autocomplete="false" value="{$endtime}"/>
            <input type="submit" value="搜索" class="button button-blue" />
        </form>
    </div>
    <div class="fn-right button-group">
        <a href="{:url('coupon/index',['time' => 1,'types'=>0])}" class="button {$time==1?'button-violet':''}">今日</a>
        <a href="{:url('coupon/index',['time' => 2,'types'=>0])}" class="button {$time==2?'button-violet':''}">昨日</a>
        <a href="{:url('coupon/index',['time' => 30,'types'=>0])}" class="button {$time==30?'button-violet':''}"">本月</a>
        <a href="{:url('coupon/index',['time' => 60,'types'=>0])}" class="button {$time==60?'button-violet':''}"">上月</a>
    </div>
</div>
<div class="cards">
    <div class="card blue">
        <div class="fn-left"><i class="iconfont icon-my_icon"></i></div>
        <div class="fn-right fn-tar"><div class="num">{$coupon_count}</div><div class="text">优惠券数量</div></div>
    </div>
    <div class="card blue">
        <div class="fn-left"><i class="iconfont icon-my_icon"></i></div>
        <div class="fn-right fn-tar"><div class="num">{$coupon_end_count}</div><div class="text">失效数量</div></div>
    </div>
    <a href="{:url('coupon/user',['types' => 0])}" class="card yellow">
        <div class="fn-left"><i class="iconfont icon-renminbi1688"></i></div>
        <div class="fn-right fn-tar"><div class="num">{$coupon_user_count}</div><div class="text">已领数量</div></div>
    </a>
    <a href="{:url('coupon/user',['types' => 1])}" class="card yellow">
        <div class="fn-left"><i class="iconfont icon-renminbi1688"></i></div>
        <div class="fn-right fn-tar"><div class="num">{$coupon_user_end_count}</div><div class="text">已领(用完/失效)</div></div>
    </a>
</div>
<div class="titlebar"><i class="iconfont icon-text_icon"></i>优惠券列表</div>
<div id="actionbar">
    <div class="fn-left">
        <a class="button button-blue" href="{:url('coupon/edit')}"> <i class="iconfont icon-add_icon"></i>增加优惠券</a>
    </div>
    <div class="fn-right ">
        <form id="form" action="{:url('coupon/index')}" method="get" class="input-group">
            <input type="hidden" id="store_id" name="store_id" value="{$store_id}"/>
            <input url="{:url('smartbc/store/selectStore')}" id="selectStore" readonly="true" placeholder="好店名称" class="input readonly selectID" type="text" name="store_name"  value="{$store_name}" readonly/>
            <input placeholder="请输入优惠券名称" class="input" type="text" name="keyword" value="{$keyword}"/>
            <input type="submit" value="搜索" class="button button-blue" />
        </form>
    </div>
    <div class="fn-right button-group">
        <a href="{:url('coupon/index',['types'=>0,'time' => $time,'starttime' => $starttime,'endtime' => $endtime])}" class="button{if $types == 0} button-green{/if}">所有优惠券</a>
        <a href="{:url('coupon/index',['types'=>1,'time' => $time,'starttime' => $starttime,'endtime' => $endtime])}" class="button{if $types == 1} button-green{/if}">待审核</a>
        <a href="{:url('coupon/index',['types'=>2,'time' => $time,'starttime' => $starttime,'endtime' => $endtime])}" class="button{if $types == 2} button-green{/if}">已审核</a>
        <a href="{:url('coupon/index',['types'=>4,'time' => $time,'starttime' => $starttime,'endtime' => $endtime])}" class="button{if $types == 4} button-yellow{/if}">过期/领完</a>
    </div>
</div>
<table class="table table-border">
    <thead>
        <tr>
            <th class="w60 fn-tac">排序</th>
            <th>优惠券信息</th>
            <th class="w90 fn-tac">类型</th>
            <th class="w90 fn-tar">满用(￥)</th>
            <th class="w90 fn-tar">抵扣/折扣</th>
            <th class="w120 fn-tac">更新日期</th>
            <th class="w60 fn-tac">状态</th>
            <th class="w150 fn-tac">操作</th>
        </tr>
    </thead>
    <tbody>
        {foreach $lists as $vo}
        <tr>
            <td class="fn-tac"><input name="sort" class="fn-tac w40 input input-mini" type="text" value="{$vo['sort']}" id="{$vo.id}" /></td>
            <td>
                <i class="iconfont icon-discount"></i><span class="selectID fn-cp fn-fb" url="{:url('coupon/review',['id'=>$vo.id])}">{$vo.name}</span><br />
                <span class="gray"><i class="iconfont icon-wodedingdan2"></i>{$vo.tips}</span><br />
                <span class="selectID fn-cp" url="{:url('store/review',['id'=>$vo.store.id])}"><i class="iconfont icon-store_icon"></i>{$vo.store.name}</span>
            </td>
            <td class="fn-tac">{$vo.types == 1 ?'折扣券':'代金券'} </td>
            <td class="fn-tar"><i class="iconfont icon-renminbi1688"></i>{$vo.howmuch|money}</td>
            <td class="fn-tar">{if $vo.types}{$vo.discount}折{else}￥{$vo.price}{/if}</td>
            <td class="fn-tac">{$vo.update_time|date="Y-m-d"}</td>
            <td class="fn-tac">
                {if $vo.is_end}
                    <span class="fn-cp istop badge bg-red" url="{:url('coupon/isend',['id'=>$vo.id])}" title="过期/领完">失效</span>
                {else}
                    <span class="fn-cp istop badge {$vo.is_lock?'bg-green':''}" url="{:url('coupon/islock',['id'=>$vo.id])}">{$vo.is_lock?'未审':'已审'}</span><br />
                    <span class="fn-cp istop badge {$vo.is_top?'bg-blue':''}" url="{:url('coupon/istop',['id'=>$vo.id])}">{$vo.is_top?'推荐':'推荐'}</span>
                {/if}
            </td>
            <td class="button-group">
                <a class="button button-mini" href="{:url('coupon/edit',['id'=>$vo.id,'page' => $page])}"><i class="iconfont icon-edit"></i>编辑</a>
                <a class="button button-mini isDel" url="{:url('coupon/delete',['id'=>$vo.id])}" href="javascript:;" title="删除"><i class="iconfont icon-lajixiang"></i>删除</a>
            </td>
        </tr>
        {/foreach}
    </tbody>
</table>
{$lists|raw}
<script type="text/javascript">
Do('base','layer', function () {
    sort("{:url('coupon/sort')}");
    $('.isDel').isDel();
    $('.istop').actUrl();
    $(".selectID").win();
})
function setState(store){
    $("#store_id").val(store.id);
    $("#selectStore").val(store.store_name);
}
</script>